<template>
	<div>
		<CarList :unfold="unfold" :bodys="bodys" :hide="false"></CarList>
	</div>
</template>

<script>
	import Head from "@/components/Head.vue"
	import CarList from '@/components/CarList.vue'
	import { search } from "../api/jsoup"
	export default {
		name: "MyCookies",
		components: {
			Head,
			CarList
		},
		data() {
			return {
				bodys: undefined,
				unfold: 1,
				user:{},
			}
		},
		methods: {
			
			__search:function(data){
				let res = eval("(" + data + ")");
				this.bodys = res[0];
				console.log(this.bodys);
			},
			_search(query){
				if($.cookie("user")) this.user = JSON.parse($.cookie("user"));
				if(this.user.id!=undefined){
					search(query,this.__search);
				} else {
					Vue.$message({
						message: `请登录！！！`,
						type: 'warning'
					});
				}
			},
		},
		mounted() {
			if($.cookie("user")) this.user = JSON.parse($.cookie("user"));	
				if(this.user.id!=undefined){
					search({table:'brief',start:0,num:20,keys:this.user.id},this.__search);
				} else {
					Vue.$message({
						message: `请登录！！！`,
						type: 'warning'
				});
			}
		}

	}
</script>

<style>
</style>
